package com.sketch.controller;

import com.sketch.commom.PageResult;
import com.sketch.commom.Result;
import com.sketch.entity.dto.GoldRecordDTO;
import com.sketch.service.GoldRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Api(tags = "金币记录管理 API")
@RequestMapping(value = "/api/goldRecord")
public class GoldRecordController {
    @Resource
    private GoldRecordService goldRecordService;
    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("列表")
    public Result<PageResult<GoldRecordDTO>> list(@ApiParam(value = "事件名称") @RequestParam(required = false) String name,
                                                  @RequestParam(value = "startDate") String startDate,
                                                  @RequestParam(value = "endDate") String endDate,
                                                  @ApiParam(value = "uid") @RequestParam(required = false) Long uid,
                                                  @RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
                                                  @RequestParam(value = "size", defaultValue = "20", required = false) Integer size) {
        return goldRecordService.list(name,endDate,startDate,uid, page, size);
    }

}
